import { _decorator, Component, Node } from 'cc';
import { Logger } from 'db://assets/util';
import { DialogFrame } from '../components/DialogFrame';
import { ROLE_TYPE } from 'db://assets/enum';
const { menu, ccclass, property } = _decorator;

@ccclass('DialogContainer')
@menu('container/Dialog')
export class DialogContainer extends Component {
    #logger = new Logger('对话框容器::DialogContainer')

    @property(DialogFrame)
    dialogFrame: DialogFrame;

    async clear() {
        await this.dialogFrame.clear()
    }

    showDialog(dialogContent: LDContent.DialogContent) {
        this.#logger.debug('@showDialog %o', dialogContent)
        switch (dialogContent.dialog.who.type) {
            case ROLE_TYPE.MAJOR:
                this.dialogFrame.showMajorDialog(dialogContent)
                break
            case ROLE_TYPE.MINOR:
                this.dialogFrame.showMinorDialog(dialogContent)
                break
            case ROLE_TYPE.NARRATOR:
                this.dialogFrame.showNarratorDialog(dialogContent)
                break
        }
    }

    start() {
        this.#logger.debug('#start')
    }




}

